﻿<UserControl x:Class="Hardanger.View.ServerFuzzerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 		
			 xmlns:pv="clr-namespace:Hardanger.View.Partial"
             xmlns:vm="clr-namespace:Hardanger.ViewModel"
             mc:Ignorable="d" 
             d:DesignHeight="573" d:DesignWidth="1092">

    <Grid DataContext="{Binding ServerFuzzer}">
        <Border Margin="12,207,12,12" BorderBrush="Black" BorderThickness="1">
			<ScrollViewer VerticalScrollBarVisibility="Auto">
                <StackPanel Name="spFuzzerConfig" CanVerticallyScroll="True" IsEnabled="{Binding FuzzingEnabled}">
					<pv:ServerFuzzerConfigurationItem DataContext="{Binding FuzzerConfiguration[Headers]}" />
					<pv:ServerFuzzerConfigurationItem DataContext="{Binding FuzzerConfiguration[GetParameters]}"/>
					<pv:ServerFuzzerConfigurationItem DataContext="{Binding FuzzerConfiguration[PostParameters]}"/>				
				</StackPanel>
			</ScrollViewer>
		</Border>
        <GroupBox Header="SessionStats" Height="75" HorizontalAlignment="Left" Margin="12,12,0,0" Name="groupBox1" VerticalAlignment="Top" Width="656" FontWeight="Bold" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
            <Grid>
                <Label Content="Request Count:" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,6,0,0" FontWeight="Bold" />
                <TextBlock Height="23" HorizontalAlignment="Left" Margin="108,11,0,0" Name="txtRequestCount" Text="{Binding Iterations,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="89" />
                <Label Content="Result Count:" Height="28" HorizontalAlignment="Left" Margin="203,6,0,0" Name="label2" VerticalAlignment="Top" Width="91" FontWeight="Bold" />
                <TextBlock Height="23" HorizontalAlignment="Left" Margin="292,11,0,0" Name="txtResultCount" Text="{Binding SessionResultsCount}" VerticalAlignment="Top" Width="89" />
                <Label Content="#Threads:" Height="28" HorizontalAlignment="Left" Margin="387,6,0,0" Name="label4" VerticalAlignment="Top" FontWeight="Bold" />
                <TextBlock Height="23" HorizontalAlignment="Left" Margin="458,11,0,0" Name="textBox1" VerticalAlignment="Top" Width="45" Text="{Binding CurrentNumberOfThreads,UpdateSourceTrigger=PropertyChanged}" />
                <Button Content="{Binding FuzzerButtonText,UpdateSourceTrigger=PropertyChanged, FallbackValue='Start Fuzzing'}" Height="23" HorizontalAlignment="Right" Margin="0,7,42,0" VerticalAlignment="Top" Width="82" Command="{Binding Path=ToggleFuzzerCommand}" />
            </Grid>
        </GroupBox>
        <GroupBox Header="SessionSettings" Height="111" HorizontalAlignment="Left" Margin="12,91,0,0" Name="groupBox2" VerticalAlignment="Top" Width="656" FontWeight="Bold" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
            <Grid>
                <Label Content="Max Threads:" Height="28" HorizontalAlignment="Left" Margin="14,40,0,0" Name="label1" VerticalAlignment="Top" FontWeight="Bold" ToolTip="Sets the desired number of threads to run." />
                <Slider Minimum="1" Maximum="{Binding MaximumThreadsAvailable}" IsSnapToTickEnabled="True" SmallChange="1" Height="23" HorizontalAlignment="Left" Margin="106,45,0,0" Name="ThreadSlider" VerticalAlignment="Top" Width="100" Value="{Binding MaxThreadCount}" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="212,45,0,0" Name="ThreadTextBox" VerticalAlignment="Top" Width="58" Text="{Binding ElementName=ThreadSlider,Path=Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                <Label Content="Sleep Time(ms):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" Name="label3" VerticalAlignment="Top" FontWeight="Bold" ToolTip="Sets the time in milliseconds a thread will wait between requests." />
                <Slider Minimum="0" Maximum="900000" Height="23" HorizontalAlignment="Left" SmallChange="1" Margin="106,11,0,0" VerticalAlignment="Top" Width="100" Name="WaitSlider" Value="{Binding RequestPause}" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="212,11,0,0" VerticalAlignment="Top" Width="58" Text="{Binding ElementName=WaitSlider,Path=Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                <Label Content="Request Timeout(ms):" Height="28" HorizontalAlignment="Left" Margin="276,9,0,0" Name="label5" VerticalAlignment="Top" FontWeight="Bold" />
                <Slider Minimum="60000" Maximum="600000" Height="23" HorizontalAlignment="Left" Margin="416,11,0,0" Name="TimeOutSlider" VerticalAlignment="Top" Width="98" Value="{Binding RequestTimeOut}" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="520,8,0,0" Name="textBox2" VerticalAlignment="Top" Width="54" Text="{Binding ElementName=TimeOutSlider, Path=Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                <CheckBox Content="Strip PragmaNoCache" IsChecked="{Binding StripPragmaNoCache}" Height="16" HorizontalAlignment="Left" Margin="276,45,0,0" Name="checkBox2" VerticalAlignment="Top" />
                <CheckBox Content="Strip IfModifiedSince" IsChecked="{Binding StripIfModifiedSince}" Height="16" HorizontalAlignment="Left" Margin="423,45,0,0" Name="checkBox1" VerticalAlignment="Top" />
            </Grid>
        </GroupBox>
        <GroupBox Header="Detection Engines" Height="190" Margin="674,12,0,0" Name="groupBox3" VerticalAlignment="Top" FontWeight="Bold" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
            <Grid>
                <ListBox Height="82" HorizontalAlignment="Stretch" Margin="6,79,0,0" Name="listBox1" VerticalAlignment="Top" Width="393" ItemsSource="{Binding SelectedDetectionEngines}" SelectedValue="{Binding ListBoxSelectedDetectionEngine}"  />
                <ComboBox Height="23" HorizontalAlignment="Stretch" Margin="6,11,0,0" Name="comboBox1" VerticalAlignment="Top" Width="393" ItemsSource="{Binding DetectionEngines}" SelectedValue="{Binding DropDownSelectedDetectionEngine}" SelectedIndex="0"/>
                <Button Content="Add" Height="23" HorizontalAlignment="Stretch" Margin="10,50,321,0" Name="button1" VerticalAlignment="Top" Width="75" Command="{Binding AddDetectionEngineCommand}" />
                <Button Content="Remove" Height="23" HorizontalAlignment="Stretch" Margin="243,50,88,0" Name="button2" VerticalAlignment="Top" Width="75" Command="{Binding RemoveDetectionEngineCommand}"/>
                <Button Content="Add All" Height="23" HorizontalAlignment="Stretch" Margin="90,50,240,0" Name="button3" VerticalAlignment="Top" Width="75" Command="{Binding AddAllDetectionEnginesCommand}" />
                <Button Content="Remove All" Height="23" HorizontalAlignment="Stretch" Margin="324,50,8,0" Name="button4" VerticalAlignment="Top" Width="75" Command="{Binding RemoveAllDetectionEnginesCommand}" />
            </Grid>
        </GroupBox>
        <!--<Label Content="Trace" HorizontalAlignment="Left" Margin="12,0,0,144" Name="label3" Height="28" VerticalAlignment="Bottom" />
			<ScrollViewer Margin="12,0,12,12" Name="scrollViewer1" Height="126" VerticalScrollBarVisibility="Visible" VerticalAlignment="Bottom">
				<TextBlock Name="txtOutputTrace" Text="Fuzzing Output Trace" Background="#1E190000" />
			</ScrollViewer>-->
	</Grid>
</UserControl>
